package freaks.terah.model;

import java.awt.Color;
import java.awt.Component;

import javax.swing.DefaultListCellRenderer;
import javax.swing.JList;

public class RessourceListRenderer extends DefaultListCellRenderer {
    
	  /**
		 * 
		 */
	  private static final long serialVersionUID = 1L;

	  /** Creates a new instance of ColorRenderer */
	  public RessourceListRenderer() {
	  }
	    
	  public Component getListCellRendererComponent(JList list, 
	                                                Object value,
	                                                int index, 
	                                                boolean isSelected,
	                                                boolean cellHasFocus) {

	    super.getListCellRendererComponent(list, 
	                                       value, 
	                                       index, 
	                                       isSelected, 
	                                       cellHasFocus);
	    if (value instanceof Ressource) {
	      Ressource res = (Ressource) value;
	      setText(res.getName());
	      
	      setForeground(Color.BLACK);
	    }
	    return this;
	  }
	}